<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
  
  http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!DOCTYPE html>
<html>
  <head>
    <title>Facebook Login Example App for Apigee App Services (Usergrid)</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="../resources/css/bootstrap-combined.min.css" />
    <link rel="stylesheet" href="../resources/css/styles.css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
    <script src="../../usergrid.js" type="text/javascript"></script>
    <script src="app.js" type="text/javascript"></script>
    <script src="//connect.facebook.net/en_US/all.js" type="text/javascript"></script>
  </head>
  <body>
    <div class="header">
      <img src="../resources/images/apigee.png"> App Services (Usergrid) Javascript SDK
    </div>
    <div class="breadcrumb">
        <a href="../../index.html">&lt;&lt; examples</a>
      </div>
    <div class="info">
      This sample application will show you how to log into App Services (Usergrid) using Facebook and the Usergrid Javascript SDK.
      Enter the <a href="https://developers.facebook.com/apps/">API Key that you get from Facebook</a>, then log in.
      <br/><br/>
      The Log in button sends the user to the facebook login page.  Once the user logs in, they are redirected back to
      this page and automatically logged into Usergrid.  If the user is already logged into facebook, then they don't need to log in again.
      <br/><br/>
      Clicking the log out button calls the logout method of the Facebook JS SDK, and also logs the user out of Usergrid by calling the Usergrid logoutAppUser method.
      <br/><br/>
      For a step by step walk-thru on how to get this app running, see this <a href="guide.html">guide</a>.
      <br/><br/>
      For more information on App Services, see our <a href="http://apigee.com/docs/app_services">docs</a> site, specifically or our <a href="http://apigee.com/docs/usergrid/content/facebook-sign-in">Facebook docs page</a>.
      <br/><br/>
      For more information on how using the Facebook JS SDK to log users in, see this guide: <a href="http://developers.facebook.com/docs/howtos/login/getting-started/">http://developers.facebook.com/docs/howtos/login/getting-started/</a>
    </div>
    <div id="main" class="main">
      <div class="section-header">Log in with Facebook</div>
      <div class="well">
        <div id="name-control" class="control-group">
          <div class="controls">
            <label class="control-label" for="get-path">Facebook API key (<a href="https://developers.facebook.com" target="_blank">Learn more</a>)</label>
            <input type="text" name="api-key" id="api-key" class="span4" style="float: left;" value="308790195893570"/>
            <span class="span4 left" style="width: 10px; float: left;">&nbsp;</span>
            <button class="btn btn-primary" id="login-button" style="width: 90px;">Log In</button>
            <button class="btn btn-primary" id="logout-button" style="width: 90px;">Log out</button>
            <span style="clear: both;">&nbsp;</span>
          </div>
        </div>
      </div>
      <div class="section-header"><b>API Response</b></div>
      <div class="well" id="facebook-status">
        // Press 'Log in' to log in with Facebook.
      </div>
    </div>
    <div id="fb-root" class=" fb_reset"> </div>
  </body>
</html>
